#pragma once

#include "MBVec3.h"

/**
  * Plane in 3D space defined by a point and a normal vector
  */
class MBPlane
{
public:
	MBPlane(
		const MBVec3 &normal = MBVec3( 0.0, 0.0, 1.0 ),
		const MBVec3 &point = MBVec3( 0.0, 0.0, 0.0 ) );

	double GetDistanceToPoint( const MBVec3 &point ) const;
	bool IsPositiveVertexOfAxisAlignedBoxOutside( const MBVec3 &boxMin, const MBVec3 &boxMax ) const;
	void SetNormalAndPoint( const MBVec3 &normal, const MBVec3 &point );

private:
	/** Normal vector */
	MBVec3 mNormal;
	/** Point lying on the plane */
	MBVec3 mPoint;
	/** Value D which satisfies the equation D = -normal * point */
	double mD;
};